import { getAreaTree } from '@/api/common';
import { FormProps } from '@/components/Table';

export function getFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 60,
    compact: true,
    size: 'default',
    autoSubmitOnEnter: true,
    submitOnReset: true,
    schemas: [
      {
        field: 'keyword',
        component: 'Input',
        label: '搜索',
        colProps: {
          span: 8,
        },
        componentProps: {
          placeholder: '搜索关键词',
        },
      },
      {
        field: 'region',
        component: 'ApiSelect',
        label: '地区',
        colProps: {
          span: 8,
        },
        componentProps: () => {
          return {
            showSearch: true,
            api: getAreaTree,
            optionFilterProp: 'label',
            immediate: false,
            params: {},
            labelField: 'areaName',
            valueField: 'areaCode',
          };
        },
      },
    ],
  };
}
